package example;

import java.util.Map;

import com.ai.appframe2.common.AIException;
import com.ai.redis.util.RedisClusterUtil;
import com.alibaba.fastjson.JSONObject;
import com.asiainfo.ssm.execute.bo.BOExecOrderBean;
import com.asiainfo.ssm.execute.ivalues.IBOExecOrderValue;
import com.asiainfo.ssm.execute.util.ExecStatic;
import com.asiainfo.ssm.execute.util.RedisFuncHelper;

public class TestJedisCluster {
	public static void main(String[] args) throws Exception {
//		createTestRds();
//		addExecIns();
//		openPoint();
		getExecOrder(); 
	}
	
	
	private static void openPoint(){
		RedisFuncHelper.setCriticalPointSwitch("8001", ExecStatic.CRITIAL_POINT_SWITCH_OPEN);

		boolean isOpen = RedisFuncHelper.getCriticalPointSwitch("8001");
		System.out.println(isOpen);
	}
	
	private static void addExecIns() throws AIException{
		IBOExecOrderValue[] orders = new BOExecOrderBean[1];
		orders[0]=new BOExecOrderBean();
		orders[0].setOrdId(3);
		orders[0].setBillId("13681768891");//13918259391;13564568978
		orders[0].setActId("20003");
		orders[0].setCriticalPointId(9001);
		orders[0].setCampsegContent("");
		orders[0].setExecState(1);
		RedisFuncHelper.addExecOrder(orders);
 	}
	
	
	
	private static void createTestRds()throws AIException{
		IBOExecOrderValue[] orders = new BOExecOrderBean[1];
		orders[0]=new BOExecOrderBean();
		orders[0].setOrdId(4);
		orders[0].setBillId("13681768891");//13918259391;13564568978
		orders[0].setActId("20005");
		orders[0].setCriticalPointId(8001);
		orders[0].setCampsegContent("");
		orders[0].setExecState(1);
		RedisFuncHelper.addExecOrder(orders);
		orders[0]=new BOExecOrderBean();
		orders[0].setOrdId(5);
		orders[0].setBillId("13918259391");//13918259391;13564568978
		orders[0].setActId("20005");
		orders[0].setCriticalPointId(8001);
		orders[0].setCampsegContent("");
		orders[0].setExecState(1);
		RedisFuncHelper.addExecOrder(orders);
		orders[0]=new BOExecOrderBean();
		orders[0].setOrdId(5);
		orders[0].setBillId("13564568978");//13918259391;13564568978
		orders[0].setActId("20005");
		orders[0].setCriticalPointId(8001);
		orders[0].setCampsegContent("");
		orders[0].setExecState(1);
		RedisFuncHelper.addExecOrder(orders);
		orders[0]=new BOExecOrderBean();
		orders[0].setOrdId(6);
		orders[0].setBillId("13564568978");//13918259391;13564568978
		orders[0].setActId("20002");
		orders[0].setCriticalPointId(8001);
		orders[0].setCampsegContent("");
		orders[0].setExecState(1);
		RedisFuncHelper.addExecOrder(orders);
	}
	
	private static void getExecOrder() throws AIException{
	 
		Map map= RedisFuncHelper.getExecOrderMap("13681768891", "8001");
		System.out.println(JSONObject.toJSON(map));
 	}
	
	
	//10001
}
